home *** CD-ROM | disk | FTP | other *** search
/ Your Choice 3 / Your Choice Software Collection 3.iso / prgmming / swag05 / egavga.swg < prev    next >
Encoding:
Text File  |  1994-09-22  |  9.6 KB  |  1 lines

  1. SWAGOLX.EXE (c) 1993 GDSOFT  ALL RIGHTS RESERVED 00007                                                                           1      05-25-9408:13ALL                      MIGUEL MARTINEX          VGA Text Fonts           SWAG9405            8      Üd   {π ▒   Hey.. AnyBody out there know how to change TEXT fonts w/ Pascal?π ▒ Any routines would be apprecited....ππYes, a friend of mine made a text font editor, a couple of years ago, but itπwould be too long to post it in this conference. You may use this routine toπset a 8x16 text font.ππYou should pass to this procedure an array of 4096 bytes. This array shouldπcontain the whole 256 character set, structured in blocks of 16 bytes forπeach char:ππ{------Cut Here------}ππUnit Fonts;ππInterfaceππType TextFont=Array[0..4095] of byte;ππProcedure ActivateFont(Block:Textfont);ππImplementationππProcedure ActivateFont; Assembler;πAsmπ  push esπ  mov ax,1100hπ  mov bx,1000hπ  mov cx,100hπ  xor dx,dxπ  push bpπ  les bp,Blockπ  int 10hπ  pop bpπ  pop esπEnd;ππBeginπEnd.ππ                                                                                                                            2      05-25-9408:22ALL                      GREG ESTABROOKS          ROM Font in $13          SWAG9405            21     Üd   {π The following does not use assembly but it should do what you want,π and should give you an idea about how its done incase you want toπ translate it to BASM later. It uses the ROM text font informationπ for its screen writes.ππ{***********************************************************************}πPROGRAM RomFontDemo;            { May 08/94, Greg Estabrooks.           }πVARπ   Colors :BYTE;ππPROCEDURE SetVidMode( Mode :BYTE ); ASSEMBLER;π                {  Routine to set video mode                            }πASMπ  Mov AH,00                     {  Function to set mode                 }π  Mov AL,Mode                   {  Mode to change to                    }π  Int $10                       {  Call dos                             }πEND;{SetVidMode}ππPROCEDURE PutPixel( X,Y :WORD; Color :BYTE );πBEGINπ  Mem[$A000:(320*Y)+X]:= Color;πEND;ππPROCEDURE WriteXY( X,Y :WORD; Color :BYTE; Str :STRING );πVARπ   OldX :WORD;                  { Holds Original Column.                }π   OldY :WORD;π   StrPos :BYTE;                { Character pos in string to write.     }π   FontChr:BYTE;                { ROM font info.                        }π   FontPos:BYTE;π   BitPos :BYTE;πBEGINπ  OldY := Y;                    { Save Starting Row.                    }π  FOR StrPos := 1 TO Length(Str) DOπ  BEGIN                         { Loop through every character.         }π   OldX := X;                   { Save Current Column.                  }π   Y := OldY;                   { Restore starting row.                 }π   FOR FontPos := 0 TO 7 DOπ   BEGIN                        { Scroll through all 8 BYTES of font.   }π    FontChr := MEM[$FFA6:$E+(ORD(Str[StrPos]) SHL 3) + FontPos];π    FOR BitPos := 7 DOWNTO 0 DOπ    BEGIN                       { Scroll through all 8 BITS of each BYTE.}π     IF (FontChr AND (1 SHL BitPos)) <> 0 THENπ      PutPixel(X,Y,Color);      { IF bit is set then draw pixel.        }π     INC(X);                    { point to next column.                 }π    END;π    INC(Y);                     { point to next row.                    }π    X := OldX;                  { Restore old column for next line.     }π   END;π   X := X + 8;                  { Move 9 columns ahead.                 }π  END;πEND;{WriteXY}ππBEGINπ  SetVidMode($13);π  FOR Colors := 1 TO 19 DOπ   WriteXY(Colors*10,Colors*10,Colors,'Greg Estabrooks');π  Readln;π  SetVidMode($03);πEND.π{***********************************************************************}π                                                                                      3      05-25-9408:24ALL                      IAN LIN                  25 & 50 Line mode in ASM SWAG9405            4      Üd   {π SG> ok.. how do you switch from 50 line mode to 25 line mode in assembly,π SG> and vice versa? I've tried many ways, which crash every now and then...π}πTo 25 lines:ππUses crt;πbeginπtextmode(co80); {co80=3}πend.ππTo 50 lines:πprocedure vga50;πassembler;πasmπ mov ax,1202hπ mov bl,30hπ int 10hπ mov ax,3π int 10hπ mov ax,1112hπ mov bl,0π int 10hπend;πbeginπ vga50πend.ππ           4      05-25-9408:24ALL                      GARETH BRAID             VGA Detection            SWAG9405            8      Üd   {πPF> Can anyone give me the source code for a vga detectionπPF> routine taht doesnt use the bgi driver. Thanks in advance PF> for yourπhelp.ππPF> Patrick FoxππTo detect a VGA card simply <g> call Interrupt 10h with ah set as 1Ah, if al isπnow 1A then there is a VGA present - otherwise it must be something else...ππi.e. ( regs is declared as of type registers from the DOS unit)π}ππbeginπ  with regs doπ   beginπ    ah:=$1A;π    al:=00;π    intr ($10, regs);π    If al=$1A then Writeln ('VGA Detected...'); {or whatever...}π   end;πend.ππor in the built-in assembler something like this...ππFunction isVGA:Boolean; Assembler;ππasmπ   mov AH, $1Aπ   mov al, $00π   Int $10π   cmp al, $1Aπ   jne @@NOVGABIOSπ   mov al, 1π   jmp @@EXITπ  @@NOVGABIOS:π   mov al, 0π  @@EXIT:πend;π                                                                                                                      5      05-25-9409:25ALL                      WIM VAN DER VEGT         Linked in BGI files      SWAG9405            12     Üd   {πHere's the recipe to get rid of missing BGI drivers!πππTo get EGAVGA.OBJ use the BINOBJ utility supplied with Turbo PascalπππBINOBJ EGAVGA.BGI EGAVGA EGAVGAπππTo use this unit just add it to your uses statement once and forgetπall about path's in Initgraph (use ''). The unit can be extended toπsupport additional drivers, like CGA.BGI. Read the GRAPH.DOC fileπon the TP disks.ππ-----------------------<cut hereππ{---------------------------------------------------------}π{  Project : Turbo EGAVGA Driver                          }π{  Auteur  : G.W. van der Vegt                            }π{---------------------------------------------------------}π{  Datum .tijd  Revisie                                   }π{  920301.1300  Creatie.                                  }π{---------------------------------------------------------}ππUNIT Bgi_01;ππINTERFACEππUSESπ  Graph;ππIMPLEMENTATIONππ{------------------------------------------------}π{----EGAVGA.BGI Driver                           }π{------------------------------------------------}ππPROCEDURE Egavga; External;ππ{$L Egavga.obj}ππBEGINπ  IF RegisterBGIDriver(@Egavga)<0π     THENπ       BEGINπ         Writeln('Error registering driver: ',π                  GraphErrorMsg(GraphResult));π         Halt(1);π       END;πEND.π                                                                                                                            6      05-26-9406:15ALL                      FLORIAN ANSORGE          Fading Unit              SWAG9405            18     Üd   UNIT FadeUnit;        { This unit does some fading (I hope!) }π                      { The SetCol procedure lets you change individual}π                      { palette entries , for an easier way, try }π                      { the TP setrgbpalette procedure...}π                      { Regards Florian Ansorge :-) }πINTERFACEππProcedure InitCol; {gets the current palette and saves it}ππProcedure FadeOUT(Duration:Byte);   { lowers/increases the brightness,}πProcedure FadeIN(Duration:Byte);    { duration determines the time it takes}ππProcedure SetBrightness(Brightness :Byte);π                                    {sets the brightness to brightness / 63 }πIMPLEMENTATIONππUSES Crt, Dos;ππCONST     PelIdxR  = $3c7; {Port to read}π          PelIdxW  = $3c8; {Port to write}π          PelData  = $3c9; {Dataport}π          Maxreg   = 255;  {Set to 63 for textmode}π          MaxInten = 63;ππVAR col : ARRAY[0..MaxReg] of RECORDπ                                r, g, b : Byteπ                              END;ππPROCEDURE GetCol(ColNr :Byte; var r, g, b :Byte);πBEGINπ  Port[PelIdxR] := ColNr;π  r := Port[PelData];π  g := Port[PelData];π  b := Port[PelData];;πEND;ππPROCEDURE SetCol(ColNr, r, g, b :Byte); {Change just one colour}πBEGINπ  Port[PelIdxW] := ColNr;π  Port[PelData] := r;π  Port[PelData] := g;π  Port[PelData] := b;πEND;ππPROCEDURE InitCol; {save initial palette}ππVAR i :Byte;ππBEGINπ  FOR i := 0 to MaxReg DOπ    GetCol(i,col[i].r,col[i].g,col[i].b);πEND;ππPROCEDURE SetBrightness(Brightness :Byte);ππVAR i          :Byte;π    fr, fg, fb :Byte;ππBEGINπ  FOR i := 0 to MaxReg DOπ  BEGINπ    fr := col[i].r * Brightness DIV MaxInten;π    fg := col[i].g * Brightness DIV MaxInten;π    fb := col[i].b * Brightness DIV MaxInten;π    SetCol(i,fr,fg,fb);π  END;πEND;ππPROCEDURE FadeOUT(Duration :Byte);ππVAR i :Byte;ππBEGINπ  FOR i := MaxInten downto 0 DOπ  BEGINπ    SetBrightness(i);π    Delay(Duration);π  END;πEND;ππPROCEDURE FadeIN(Duration :Byte);ππVAR i :Byte;ππBEGINπ  FOR i := 0 to MaxInten DOπ  BEGINπ    SetBrightness(i);π    Delay(Duration);π  END;πEND;ππBEGINπEND.π                                                                                          7      05-26-9406:20ALL                      ANDRES TARZIA            28 EGA/VGA Rows          SWAG9405            5      Üd   {πAG> Does anyone out there know how to set the screen display for 28 rows, inπAG> VGA mode?  I've seen this in a couple of programs, and really like it.ππHere goes a small assembly routine to switch the screen to 28-line mode. }ππ       MOV   AX,1202          ;set up 400 scan linesπ       MOV   BL,30π       INT   10π       MOV   AX,0003          ;set up normal text modeπ       INT   10π       MOV   AX,1111          ;load ega character setπ       MOV   BL,00π       INT   10ππ